<%@include file="menu/util.jsp" %>
<%@page contentType="text/html; charset=iso-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <fmt:bundle basename="app">
        <head>

            <%@include file="menu/wizardTablessHeader.jsp" %>

            <script type="text/javascript">
                $.validator.setDefaults({
                    submitHandler: function() {
                        // closeLiveWindowMap();
                        $('#newMapDrawing').submit();
          
                    }
                });
                /*
                $().ready(function() {
                    // validate the comment form when it is submitted
                    $("#newMapDrawing").validate({
                        errorLabelContainer: $(".errorDiv"),
                        wrapper: "li"
                    });

                    $("#mapDrawingId").change(function(){
                        selectMapDrawing($(this).val());
                    });

                    
                });*/
            </script>
            <!-- File Upload plugin -->
            <!--
            <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/base/jquery-ui.css" id="theme" />
            <link rel="stylesheet" href="css/jquery.fileupload-ui.css" />
            <link rel="stylesheet" href="css/styleFileUpload.css" />
            
            <script type="text/javascript">
                function copyUrlToHiddenInput(){
                    document.getElementById('filename').value = document.getElementById('file').value;
                    document.getElementById('iconFilename0').value = document.getElementById('name').value;
                }
            </script>-->
            <c:set var="name" value=""/>
            <c:set var="description" value=""/>
            <c:set var="id" value="-1"/>
            <c:if test="${mapDrawing != null}" >
                <c:set var="name" value="${mapDrawing.name}"/>
                <c:set var="description" value="${mapDrawing.description}"/>
                <c:set var="id" value="${mapDrawing.idMapDrawing}"/>
            </c:if>

        </head>

        <body style="overflow:hidden;" >
            <form id="newMapDrawing" action="newMapDrawing.do" enctype="multipart/form-data" method="POST">
                <%@include file="menu/wizardTablessHeader2.jsp" %>
                <table>
                    <c:if test="${notMapDrawings != null && !empty notMapDrawings}">
                        <tr>
                            <td>
                                <fmt:message key="forms.similar" />
                            </td>
                            <td>
                                <select name="mapDrawingId" id="mapDrawingId">
                                    <option value="-1"><fmt:message key="forms.selectoption" /></option>
                                    <c:forEach items="${notMapDrawings}" var="mapDrawing">
                                        <option value="${mapDrawing.idMapDrawing}">${mapDrawing.name}</option>
                                    </c:forEach>
                                </select>
                            </td>
                        </tr>
                        <tr><td colspan="2"><br /><br /></td></tr>
                    </c:if>
                    <tr>
                        <td><fmt:message key="forms.name" /></td>
                        <td><input class="required" title="<fmt:message key="error.map.name"/>" type="text" name="name" id="name" value="${name}" /></td>
                    </tr>
                    <tr>
                        <td><fmt:message key="forms.description" /></td>
                        <td><input type="text" title="<fmt:message key="error.map.description"/>" name="description"  id="description" value="${description}" /></td>
                    </tr>
                    <tr>
                        <td><fmt:message key="forms.addFile" /></td>
                        <td><input class="required" title="<fmt:message key="error.map.file"/>" type="file" name="file" id="file" /></td>
                    </tr>

                    <tr><td colspan="2"></td></tr>
                </table>
                <input type="hidden" name="filename" id="filename" value="" />
                <input type="hidden" name="iconFilename0" id="iconFilename0" value="" />
                <input type="hidden" id="mapDrawId" name="mapDrawId" value="${id}" />
                <input type="hidden" id="id" name="id" value="${id}" />

                <%@include file="menu/wizardTablessMidle.jsp" %>
                <%@include file="menu/wizardTablessFooter.jsp" %>
            </form>

        </body>
    </fmt:bundle>
</html>

